package com.aaa.sso.controller;

import com.aaa.common.util.Result;
import com.aaa.sso.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @fileName:UserAndToken
 * @description:
 * @author:忆尘
 * @createTime:2020/11/13 15:51
 * @version:1.0.0
 */

@RestController
@RequestMapping("SsoController")
public class UserAndToken {

    @Autowired
    private UserService userService;

    /**
     * 用户登录功能
     * @param userName
     * @param password
     * @return
     */
    @GetMapping("userLogin")
    public Result userLogin(String userName,String password){
        return userService.userLogin(userName,password);
    }

    /**
     * 验证token
     * @param accessToken
     * @return
     */
    @GetMapping("checkToken")
    public boolean checkToken(@RequestParam("accessToken") String accessToken){
        return userService.checkToken(accessToken);
    }


}
